package com.ft.oa.web.customer;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ft.oa.domain.customer.CustomerSynergy;
import com.ft.oa.domain.dto.ApiResult;
import com.ft.oa.service.customer.CustomerSynergyService;
import com.ft.oa.web.customer.rq.CustomerSynergyPage;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


@RestController
@RequestMapping("/customer/synergy")
public class CustomerSynergyController {

    @Resource
    private CustomerSynergyService customerSynergyService;


    /**
     * 查询客户协列表
     * @param customerSynergyPage
     * @return
     */
    @PostMapping("/list")
    public ApiResult selectConditionCustomerSynergyList(@RequestBody CustomerSynergyPage customerSynergyPage){
        IPage<CustomerSynergy> customerSynergyIPage = customerSynergyService.selectConditionCustomerSynergyList(customerSynergyPage);
        return ApiResult.successWithData(customerSynergyIPage);
    }

    /**
     * 添加客户协同信息
     * @param customerSynergy
     * @return
     */
    @PostMapping("/insert")
    public ApiResult insertCustomerSynergy(@RequestBody CustomerSynergy customerSynergy){
        customerSynergyService.insertCustomerSynergy(customerSynergy);
        return ApiResult.simpleSuccess();
    }

    /**
     * 修改客户协同信息
     * @param customerSynergy
     * @return
     */
    @PostMapping("/update")
    public ApiResult updateCustomerSynergy(@RequestBody CustomerSynergy customerSynergy){
        customerSynergyService.updateCustomerSynergy(customerSynergy);
        return ApiResult.simpleSuccess();
    }

    /**
     * 删除客户协同信息
     * @param
     * @return
     */
    @PostMapping ("/del")
    public ApiResult deleteCustomerSynergy(@RequestBody  CustomerSynergy customerSynergy){
        customerSynergyService.deleteCustomerSynergy(customerSynergy);
        return ApiResult.simpleSuccess();
    }

    /**
     * 客户关系协同详情
     * @param customerSynergy
     * @return
     */
    @PostMapping("/select")
    public ApiResult selectById(@RequestBody CustomerSynergy customerSynergy){
        CustomerSynergy synergy = customerSynergyService.selectById(customerSynergy);
        return ApiResult.successWithData(synergy);
    }
}
